﻿namespace _3DExercise
{
    using System;

    public struct Point3D
    {
        //// Create a structure Point3D to hold a 3D-coordinate {X, Y, Z} in the Euclidian 3D space.
        //// Implement the ToString() to enable printing a 3D point.
        //// Add a private static read-only field to hold the start of the coordinate system – the point O{0, 0, 0}.
        //// Add a static property to return the point O.

        private static readonly Point3D ZeroPoint = new Point3D(0, 0, 0);

        private decimal coordX;
        private decimal coordY;
        private decimal coordZ;

        public Point3D(decimal x, decimal y, decimal z) : this()
        {
            this.CoordX = x;
            this.CoordY = y;
            this.CoordZ = z;
        }

        public decimal CoordX
        {
            get
            {
                return this.coordX;
            }

            private set
            {
                this.coordX = value;
            }
        }

        public decimal CoordY
        {
            get
            {
                return this.coordY;
            }

            private set
            {
                this.coordY = value;
            }
        }

        public decimal CoordZ
        {
            get
            {
                return this.coordZ;
            }

            private set
            {
                this.coordZ = value;
            }
        }

        public Point3D ZeroPointAccesser
        {
            get
            {
                return ZeroPoint;
            }
        }

        public override string ToString()
        {
            return this.coordX.ToString() + Environment.NewLine + this.coordY.ToString() + Environment.NewLine + this.coordZ.ToString();
        }        
    }
}